const { defineConfig } = require('@vue/cli-service')
const path = require('path')
const resolve = dir => {
  return path.join(__dirname, dir)
}
const name = 'vue-admin-template'
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: process.env.NODE_ENV === 'production' ? '/vue-admin-template/' : '/',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: false,
  productionSourceMap: false,
  devServer: {
    host: '0.0.0.0',
    port: 4000,
    proxy: {
      '/prod-api': {
        target: 'https://mkt.tangche.com',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
  }
  ,
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: 'vue-admin-template',
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
    // 跨域
    devServer: {

    }

  },
  chainWebpack(config) {
    config.plugins.delete('preload') // TODO: need test
  }

})
